import { Devcloud } from "../apiClass"
import { IResult } from "../../plugins/Interfaces"


export class ModuleRunApi extends Devcloud {
  private baseUrl: string = this.path + 'moduleRun/';
  async start(buildId:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "start", {buildId: buildId})
      return resp.data
  }
  async restart(moduleId:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "restart", {moduleId: moduleId})
      return resp.data
  }
  async stop(moduleId:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "stop", {moduleId: moduleId})
      return resp.data
  }
  async listPod(moduleId:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "listPod", {moduleId: moduleId})
      return resp.data
  }
  async getLogs(moduleId:number, podName:string, line:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "getLogs", {moduleId: moduleId, podName: podName, line:line})
      return resp.data
  }
  async page(param:any):Promise<IResult> {
      const resp = await this.client.post(this.baseUrl + "page", param)
      return resp.data
  }
}